package com.test.controller.zone;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.test.service.uc.PersonService;
import com.test.service.zone.SchoolService;

@Controller
@RequestMapping("/school")
public class SchoolController {
	
	@Autowired
	private SchoolService schoolService;

	@RequestMapping(value="/getSchoolById/{id}")
	public @ResponseBody Map<String,Object> testIndex(@PathVariable("id") String id){
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("id", id);
		return map;
	}
	
	@RequestMapping(value="toLogin")
	public ModelAndView toLogin(){
		ModelAndView mv = new ModelAndView();
		mv.setViewName("login");
		return mv;
	}
	
	@RequestMapping(value="checkHasSchool")
	public @ResponseBody Map<String,Object> checkHasPerson(){
		Map<String,Object> map = new HashMap<String,Object>();
		Boolean hasSchool = schoolService.hasSchool();
		map.put("state", hasSchool);
		return map;
	}
}
